//
//  Image4DSimple.h
//  V3d_Cocoa
//
//  Created by yang liang on 11-3-28.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//


#import "V3d_basicdatatype.h"
#import	"Stackutil.h"
#import	"Mg_utilities.h"
#import "ObserverableData.h"

@interface Image4DSimple : ObserverableData {
@protected
	unsigned char *data1d;
	V3DLONG sz0;
	V3DLONG sz1;
	V3DLONG	sz2;
	V3DLONG sz3;
	V3DLONG sz_time;
	TimePackType timepacktype;
	ImagePixelType datatype;
	char imgSrcFile[1024];
	int b_error;
	double rez_x,rez_y,rez_z;
	double origin_x,origin_y,origin_z;
	V3DLONG valid_zslicenum;
	V3DLONG prevalid_zslicenum;
	void* p_customStruct;	
}
-(id) initialize;
-(void) setXDim:(V3DLONG) v;
-(void) setYDim:(V3DLONG) v;
-(void) setZDim:(V3DLONG) v;
-(void) setCDim:(V3DLONG) v;
-(void) setTDim:(V3DLONG) v;

-(BOOL) setValidZSliceNum:(V3DLONG) v;
-(BOOL) setPreValidZSliceNum:(V3DLONG) v;

-(void) setDataType:(ImagePixelType) v;
-(void) setTimePackType:(TimePackType) v;

-(BOOL) setNewRawDataPointer:(unsigned char *) p;
-(void) setRawDataPointerToNull;
-(void) deleteRawDataAndSetPointerToNull;
-(void) setRawDataPointer:(unsigned char *) p;

-(BOOL) setRezX:(double) a;
-(BOOL) setRezY:(double) a;
-(BOOL) setRezZ:(double) a;

-(void) setOriginX:(double) a;
-(void) setOriginY:(double) a;
-(void) setOriginZ:(double) a;

-(void) setCustomStructPointer:(void*) a;
-(void*) customStructPointer;
-(BOOL) isValidCustomStructPointer;

-(BOOL) setData:(unsigned char *) p withImage:(Image4DSimple *) image;
-(BOOL) setData:(unsigned char *) p withX:(V3DLONG) s0 andY:(V3DLONG) s1 andZ:(V3DLONG) s2 andC:(V3DLONG) s3 andPixelType:(ImagePixelType) dt;

-(BOOL) setFileName:(const char *) myfile;
-(const char *) fileName;

-(void) loadImage:(const char *) filename;

-(BOOL) createImageWithX:(V3DLONG) s0 andY:(V3DLONG) s1 andZ:(V3DLONG) s2 andC:(V3DLONG) s3 andPixelType:(ImagePixelType) dt;
-(void) createBlankImageWithX:(V3DLONG) s0 andY:(V3DLONG) s1 andZ:(V3DLONG) s2 andC:(V3DLONG) s3 andDataType:(int) dt;

-(BOOL) isSameDataBuffer:(Image4DSimple *) p;

-(unsigned char*) rawData;

-(V3DLONG) xDim;
-(V3DLONG) yDim;
-(V3DLONG) zDim;
-(V3DLONG) cDim;
-(V3DLONG) tDim;

-(V3DLONG) validZSliceNum;
-(V3DLONG) preValidZSliceNum;

-(int) error;

-(TimePackType) timePackType;
-(ImagePixelType) imagePixelType;

-(V3DLONG) totalUnitNumber;
-(V3DLONG) totalUnitNumberPerPlane;
-(V3DLONG) totalUnitNumberPerChannel;

-(V3DLONG) unitBytes;
-(V3DLONG) totalBytes;

-(unsigned char*) rawDataAtChannel:(V3DLONG) cid;

-(int) isSuccess;
-(BOOL) valid;

-(double) rezX;
-(double) rezY;
-(double) rezZ;

-(double) originX;
-(double) originY;
-(double) originZ;

-(void) cleanExistData;

-(void) setError:(int) error;

@end
